home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / pibt40s1.arc / FINITERM.MOD < prev    next >
Text File  |  1987-06-08  |  4KB  |  90 lines

  1. (*----------------------------------------------------------------------*)
  2. (*                  FiniTerm --- Finish up PibTerm                      *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE FiniTerm;
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*     Procedure:  FiniTerm                                             *)
  10. (*                                                                      *)
  11. (*     Purpose:    Terminates PibTerm                                   *)
  12. (*                                                                      *)
  13. (*     Calling Sequence:                                                *)
  14. (*                                                                      *)
  15. (*        FiniTerm;                                                     *)
  16. (*                                                                      *)
  17. (*----------------------------------------------------------------------*)
  18.  
  19. VAR
  20.    Err : INTEGER;
  21.    I   : INTEGER;
  22.  
  23. BEGIN (* FiniTerm *)
  24.                                    (* Make sure we're in text mode *)
  25.    TextMode( Text_Mode );
  26.                                    (* Close down serial port   *)
  27.    Async_Close( Drop_Dtr_At_End );
  28.                                    (* Remove buffers               *)
  29.    Async_Release_Buffers;
  30.                                    (* Turn off keyboard handler    *)
  31.    IF Extended_Keypad THEN
  32.       Remove_Keyboard_Handler;
  33.                                    (* Turn off video handler       *)
  34.    IF Software_Scroll THEN
  35.       Remove_Video_Handler;
  36.                                    (* Close all script files           *)
  37.  
  38.    FOR I := 1 TO MaxScriptOpenFiles DO
  39.       IF Script_File_Used[I] THEN
  40.          BEGIN
  41.             IF Script_File_List[I]^.Opened THEN
  42.                BEGIN
  43.                      (*$I-*)
  44.                   CLOSE( Script_File_List[I]^.F );
  45.                      (*$I+*)
  46.                   I := IOResult;
  47.                END;
  48.          END;
  49.                                    (* Close capture file       *)
  50.    IF Capture_On THEN
  51.          (*$I-*)
  52.       CLOSE( Capture_File );
  53.          (*$I+*)
  54.                                    (* Close log file           *)
  55.    IF Log_File_Open THEN
  56.          (*$I-*)
  57.       CLOSE( Log_File );
  58.          (*$I+*)
  59.                                    (* Close down print spooling *)
  60.    IF Print_Spooling THEN
  61.       BEGIN
  62.          Err            := Close_File_Handle( Spool_File_Handle );
  63.          DISPOSE( Spool_Buffer );
  64.       END;
  65.                                    (* Remove scrolling buffer  *)
  66.    IF Review_Buffer <> NIL THEN
  67.       FREEMEM( Review_Buffer , Max_Review_Length );
  68.  
  69.                                    (* Remove Interrupt 24 trap *)
  70.    Int24OFF;
  71.                                    (* Unload all modules       *)
  72.    UnloadAllModules;
  73.                                    (* Clear screen             *)
  74.    Write_Screen_Memory := TRUE;
  75.    TimeSharingActive   := FALSE;
  76.                                    (* Assume text mode from    *)
  77.                                    (* current system setting.  *)
  78.    CASE Current_Video_Mode OF
  79.  
  80.       0, 2, 7       : Text_Mode := BW80;
  81.       1, 3, 4, 5, 6 : Text_Mode := C80;
  82.  
  83.    END (* CASE *);
  84.  
  85.    TextColor( LightGray );
  86.    TextBackGround( Black );
  87.    Set_Border_Color( Black );
  88.  
  89. END   (* FiniTerm *);
  90.